<?php

use Phinx\Migration\AbstractMigration;

class CreateResourceRouteTable extends AbstractMigration
{
    public function change()
    {
        $table = $this->table('resource_route', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '路由规则表']);

        //添加数据字段
        $table->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '主键ID'])
            ->addColumn('resource_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '所属资源id'])
            ->addColumn('route_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '规则id']);

        //执行创建
        $table->create();
    }
}
